Skip to content

fix: allow casting runtime state writes - #1898

Merged
bradygaster merged 1 commit into
devfrom
bradygaster-journal-plan-kickoff
Aug 26, 2026
Merged

bradygaster merged 1 commit into
devfrom
bradygaster-journal-plan-kickoff

Conversation

@bradygaster

Copy link
Copy Markdown
Collaborator

Summary

  • allow exactly casting/policy.json, casting/registry.json, and casting/history.json through runtime state mutations
  • keep arbitrary casting/* paths rejected
  • cover SDK validation plus orphan and two-layer state-mcp persistence
  • publish patch changesets for the CLI and SDK

Validation

  • vitest run test/state-backend.test.ts test/cli/state-mcp.test.ts
  • npm run lint
  • npm run build

Closes #1876

Closes #1876

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The allowlist change is narrowly scoped to the three required casting keys and is backed by targeted SDK and MCP integration tests that confirm both acceptance and continued rejection of other casting/* paths.

Pull request overview

This PR fixes a contract mismatch in the Squad SDK’s runtime state key validation so that state-mcp can persist the three coordinator-required casting runtime state files (casting/policy.json, casting/registry.json, casting/history.json) on non-local backends, while still rejecting arbitrary casting/* mutations. It aligns the SDK allowlist with Issue #1876 and adds coverage at both the SDK validation layer and the CLI MCP bridge layer.

Changes:

  • Allowlist exactly casting/policy.json, casting/registry.json, and casting/history.json as mutable runtime state tool keys.
  • Add SDK-level tests to ensure those keys are accepted and other casting/* paths remain rejected without worktree mutation.
  • Add state-mcp integration tests covering both orphan and two-layer backends, plus tighten test repo staging to specific files.
File summaries
File Description
packages/squad-sdk/src/tools/index.ts Extends mutable runtime state validation to include the three specific casting JSON keys and updates the error message accordingly.
test/state-backend.test.ts Adds regression coverage verifying only the three casting keys can be written via squad_state_write and that worktree .squad is not mutated.
test/cli/state-mcp.test.ts Adds MCP-bridge integration coverage ensuring casting keys can be written/read through both orphan and two-layer backends and keeps the git worktree clean.
.changeset/casting-runtime-state.md Publishes patch changesets for both @bradygaster/squad-cli and @bradygaster/squad-sdk.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit fd716ec

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 1 item(s) to address before review

Status Check Details
✅ Single commit 1 commit — clean history
✅ Not in draft Ready for review
✅ Branch up to date Up to date with dev
❌ Copilot review No Copilot review yet — it may still be processing
✅ Changeset present Changeset file found
✅ Scope clean No .squad/ or docs/proposals/ files
✅ No merge conflicts No merge conflicts
✅ Copilot threads resolved No Copilot review threads
✅ CI passing All checks passing

Files Changed (4 files, +87 −5)

File +/−
.changeset/casting-runtime-state.md +6 −0
packages/squad-sdk/src/tools/index.ts +8 −1
test/cli/state-mcp.test.ts +49 −4
test/state-backend.test.ts +24 −0

Total: +87 −5


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1898

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 1
Files modified 3
Files deleted 0
Modules touched 3
Critical files 1

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 3 modules touched (2-4 → MEDIUM)
  • Critical files touched: packages/squad-sdk/src/tools/index.ts

📦 Modules Affected

root (1 file)
  • .changeset/casting-runtime-state.md
squad-sdk (1 file)
  • packages/squad-sdk/src/tools/index.ts
tests (2 files)
  • test/cli/state-mcp.test.ts
  • test/state-backend.test.ts

⚠️ Critical Files

  • packages/squad-sdk/src/tools/index.ts

This report is generated automatically for every PR. See #733 for details.

@bradygaster
bradygaster merged commit 3155383 into dev Aug 26, 2026
18 checks passed
@bradygaster
bradygaster deleted the bradygaster-journal-plan-kickoff branch August 26, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

state-mcp rejects required casting runtime state keys

2 participants